inf2301fandomcom-20200213-history
Internet Protocol (IP)
The internet protocol (IP) is part on the Internet’s Network Layer . The Internet Protocol is responsible for addressing hosts and routing datagrams (packets) from a source host to the destination host across one or more IP networks. For this purpose the Internet Protocol defines an addressing system that has two functions. Addresses identify hosts and provide a logical location service. Each packet is tagged with a header that contains the meta-data for the purpose of delivery. This process of tagging is also called encapsulation. (wikipedia) IPv4 Datagram Format The IPv4 datagram key parts are the following: *Version number: First four bits of the datagram and specifies the version number of the datagram. By looking at the version number, routers can determine how to interpret the remainder of the IP datagram. *Header length: IPv4 datagrams can contain a variable number of options, to four bits are needed to determine where in the IP datagram the data begins. There are typically no options, giving a 20-byte header size. *Type of service: Determines the type of IP datagram (for example datagrams particularly requiring low delay, high throughput, or reliability). *Datagram length: The total length of the entire datagram. 16-bit, giving theoretical maximum size of 65.535 bytes. However, datagrams are rarely larger than 1.500 bytes. *Identifier, flags, fragmentation offset: Field regarding fragmentation. *Time-to-live: Included to ensure datagrams do not circulate forever. The field is decremented by one each time the datagram is processed by a router. If it reaches 0, it is dropped. *Protocol: Indicates to which transport layer the IP datagram should be passed (example 6 for TCP, and 17 for UDP). *Header checksum: Aids a router in detecting bit errors in a received IP datagram. The checksum is computed by treating each 2 bytes in the header as a number and summing them up using 1s complement arithmetic. The header checksum has to be recomputed and stored again at each router, as the TTL field and options may change. *Source and destination IP addresses: Capt. Obvious can tell you this. *Options: Rarely used. *Data (payload): Contains the header of the transport layer, and the payload for that. This is the actual data. IP Datagram Fragmentation The reason behind fragmentation is that not all link-layer protocols can carry network-layer packet of the same size. Some protocols can carry big packets, whereas others can carry only little packets. The maximum amount of data a link layer frame can carry is called maximum transmission unit MTU. All links can do fragmentation, but only destination and source can do reassembly. When a destination host receives a series of datagrams from the same source, it needs to determine whether any of these datagrams are fragments of some original, larger datagram. If some datagrams are fragment, it must further determine when it has received the last fragment and how the fragments it has received should be pieced back together to form the original datagram. To do this, we use the identification, flag, ''and ''fragmentation offset fields in the IP datagram header. Since IP is unreliable, one or more fragments may never arrive at the destination. For this reason, in order for the destination host to be absolutely sure it has received the last fragment of the original datagram, the last fragment has a flag bit set to 0, whereas all the other are set to 1. Also, in order for the destination host to determine whether a fragment is missing (and also to be able to reassemble the fragments in proper order), the offset field is used to specify where the fragment fits within the original IP datagram. When a datagram is to be forwarded, it checks it forwarding table to find the MTU of the link it is forwarding to. If the link has a smaller MTU than the packet size, the packet is fragmented. This is best shown with an example: Say host A wants to send a datagram of 4,000 bytes to link B. Link B has an MTU of 1,500 bytes, so A must fragment the packet into three packets. The three packets are then stamped with the identification number of the original packet, let’s say 77. The packet will then be represented as in the table below. At the destination, the payload is only forwarded to the transport layer after the IP packet has been fully reconstructed from the fragments. IPv6 Datagram Format The IPv6 datagram format: *''Version'': The same as for IPv4 *''Traffic'' class: 8-bit field. Similar to the TOS field of IPv4. * Payload length: 16-bit field. Number of bytes following the fixed 40 byte datagram header. *''Next'' header: Has the same usage as the protocol field in IPv4. * Hop limit: Same usage as the TTL field in IPv4. * Source and destination addresses: same same. *''Data'': The payload. IP Version Differences Key differences from IPv6 to IPv4: *Expanded addressing capabilities. With addresses going from 32 bits to 128 bit, there will never be a shortage on IP addresses. IPv6 also introduced a new type of address, called anycast address, which allows datagrams to be delivered to any one of a group of hosts. *A streamlined 40-byte header. A number of IPv4 fields have been dropped or made optional. The resulting 40-byte-fixed-length header allows for faster processing of the IP datagram. *Flow labeling and priority. Needed for the future. Not yet in use fully. Used to differentiate between datagrams that are considered flow like audio/video, and datagrams that are not, like e-mail and file transfers. Fields that are missing in IPv6 from IPv4: *''Fragmentation'' offset. IPv6 does not support fragmentation and reassembly at intermediate routers; these operations can be performed only at source and *''Header'' checksum. Since transport layer protocols already have checksumming, designers of IPv6 found this functionality to be sufficiently redundant. Fast processing a concern *''Options''. As the options field has been removed from IPv6, it is instead now one of the possible next headers pointed to from within the IPv6 header. That is, just as TCP or UDP protocol headers can be the next header within an IP packet, so too can an options field. Category:Alle Category:Fullført